package View;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JPanel;

/**
 * @author TNT
 */
public class FormChinh extends JPanel {

    private Image background;
    private JButton he_thong, quan_ly, thong_ke, gioi_thieu;

    public FormChinh() {
//        background = sf.createIcon("starscreenBG").getImage();

        he_thong = createButton("HE THONG", 232, 66);
        quan_ly = createButton("QUAN LY", 232, 66);
        thong_ke = createButton("THONG KE", 232, 66);
        gioi_thieu = createButton("GIOI THIEU", 232, 66);

        add(Box.createRigidArea(new Dimension(0, 230)));
        add(he_thong);
        add(Box.createRigidArea(new Dimension(0, 12)));
        add(quan_ly);
        add(Box.createRigidArea(new Dimension(0, 12)));
        add(thong_ke);
        add(Box.createRigidArea(new Dimension(0, 12)));
        add(gioi_thieu);

        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    }

    @Override
    protected void paintComponent(Graphics g) {
//        g.drawImage(background, 0, 0, null);
    }

    private JButton createButton(String text, int width, int height) {
        JButton jButton = new JButton(text);
        jButton.setMinimumSize(new Dimension(width, height));
        jButton.setPreferredSize(new Dimension(width, height));
        jButton.setMaximumSize(new Dimension(width, height));
        jButton.setAlignmentX(Component.CENTER_ALIGNMENT);
        jButton.setFocusable(false);
        jButton.setFont(new Font(Font.DIALOG, Font.BOLD, 28));
        jButton.setBackground(new Color(0xCD3E2D));
        jButton.setForeground(Color.WHITE);
        jButton.setBorder(null);
        return jButton;
    }
}
